<?php
namespace app\manage\validate;

use think\Validate;

/**
 * 行为验证器
 * @package app\menus\validate
 * @author 
 */
class Work extends Validate
{
    //定义验证规则
    protected $rule = [
        'name|标题'  => 'require',
        'post_id|团队'   => 'require|number',
        'time_rule|时间规则'   => 'require',
        'repair_rule|补卡规则'   => 'require',
        'repair_num|补卡次数'   => 'require',
        'repair_time|补卡时间'   => 'require',
        'status|状态'   => 'require',
        'start_time|开始时间'   => 'require',
        'end_time|结束时间'   => 'require',
        'week|周几'   => 'require',
    ];

    //定义验证提示
    protected $message = [
         'name.require' => '请输入考勤规则和名称',
         'post_id.require' => '请选择岗位',
         'post_id.number' => '岗位格式不正确',
         'time_rule.require' => '请输入时间规则',
         'repair_rule.require' => '请输入补卡规则',
         'repair_num.require' => '请输入补卡次数',
         'repair_time.require' => '请输入补卡时间',
         'status.require' => '请选择状态',
         'start_time.require' => '请选择开始时间',
         'end_time.require' => '请选择结束时间',
         'week.require' => '请选择周几',
    ];

    //定义验证场景
    protected $scene = [
        //更新
        'add'  =>  ['name','time_rule','repair_rule','repair_num','repair_time','work_num','status'],
        'save'  =>  ['time_rule','repair_rule','repair_num','repair_time','work_num','status'],
        'son_add' =>['start_time','end_time','week']
    ];
}
